﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SummonCardAssessor : AbstractCardTriggerAssessor
{
    public FallMagicCard  card;
    private const float SummonRange = 10f;
    public override bool AbleTrigger()
    {
        if (card.MagicEffectPrefab.GetComponent<SummonSoldier>() == null) return true;
        Collider[] towers= Physics.OverlapSphere(transform.position, SummonRange, LayerMask.GetMask(LayerNameSet.Tower));
        foreach(var tobj in towers)
        {
            var tower = tobj.GetComponent<AbstractTower>();
            if (tower != null && tobj.GetComponent<Tower>()!=null && tower.TowerOwner == card.CardOwner)
            {
                return true;
            }
        }
        return false;
    }

}
